package com.zc.demo.di;

import com.zc.demo.di.interfaces.Performer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sound.midi.Soundbank;
import java.beans.Expression;
import java.util.List;

/**
 * Created by zhangchi9 on 2016/11/2.
 */
public class ExecutionDi {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring-config.xml");
        Performer performer = (Performer)ctx.getBean("duke");
        performer.perform();
        Performer performer1 = (Performer)ctx.getBean("duke1");
        performer1.perform();
        PoeticJuggler poeticJuggler = (PoeticJuggler)ctx.getBean("poeticDuke");
        poeticJuggler.perform();
        Stage stage = (Stage)ctx.getBean("theStage");
        System.out.println(stage.getClass().getName());
        Performer performer2 = (Performer)ctx.getBean("kenny");
        performer2.perform();
        Performer performer3 = (Performer)ctx.getBean("kennyToP");
        performer3.perform();
        Performer performer4 = (Performer)ctx.getBean("hank");
        performer4.perform();
        com.zc.demo.di.Expreession expression = (com.zc.demo.di.Expreession)ctx.getBean("expression");
        System.out.println(expression.getCount());
        System.out.println(expression.getMessage());
        System.out.println(expression.getFrequency());
        System.out.println(expression.getCapacity());
        System.out.println(expression.getName());
        System.out.println(expression.isEnabled());
        expression.getInstrument().play();
        System.out.println(expression.getSong());
        System.out.println(expression.getSongSelect());
        System.out.println(expression.getSelectNull());
        System.out.println(expression.getMultiplier());
        System.out.println(expression.getRandomNumber());
        System.out.println(expression.getAddition());
        System.out.println(expression.getSubtraction());
        System.out.println(expression.getMultiplier());
        System.out.println(expression.getDivision());
        System.out.println(expression.getRemainder());
        System.out.println(expression.getArea());
        System.out.println(expression.isEqual1());
        System.out.println(expression.isEqual2());
        System.out.println(expression.isEqual3());
        System.out.println(expression.isEqual4());
        System.out.println(expression.isEqual5());
        System.out.println(expression.isEqual6());
        System.out.println(expression.isEqual7());
        System.out.println(expression.isEqual8());
        System.out.println(expression.isEqual9());
        System.out.println(expression.getCondition());
        System.out.println(expression.getCondition1());
        System.out.println(expression.getCondition2());
        System.out.println(expression.isMatches());

        ChosenCity chosenCity = (ChosenCity)ctx.getBean("chosenCity");
        System.out.println(chosenCity.getCity().getName());
        System.out.println(chosenCity.getRandomCity().getName());
        System.out.println(chosenCity.getMapCity().getName());
        System.out.println(chosenCity.getPropertiesCity());
        System.out.println(chosenCity.getPathHome());
        System.out.println(chosenCity.getApplicationHome());
        List<City> cityList = chosenCity.getCityList();
        for (City city:cityList){
            System.out.println(city.getName()+"__"+city.getPopulation());
        }
        System.out.println(chosenCity.getFirstCity().getName());
        System.out.println(chosenCity.getLastCity().getName());

        List<String> nameList = chosenCity.getCityNames();
        for (String name:nameList){
            System.out.println(name);
        }
        List<String> stateList = chosenCity.getCityNameAndStates();
        for (String state:stateList){
            System.out.println(state);
        }
    }
}
